import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:yt_devops/styles/styles.dart';

class Themes {
  static TextTheme texThemeStyle = TextTheme(
    headlineSmall: TextStyles.f14.boldStyle,
    labelSmall: TextStyles.f12.boldStyle,
    bodySmall: TextStyles.f12,
    bodyMedium: TextStyles.f14,
    displayLarge: const TextStyle(
        debugLabel: 'englishLike displayLarge 2018',
        inherit: false,
        fontSize: 96.0,
        fontWeight: FontWeight.w300,
        textBaseline: TextBaseline.alphabetic,
        letterSpacing: -1.5),
    displayMedium: const TextStyle(
        debugLabel: 'englishLike displayMedium 2018',
        inherit: false,
        fontSize: 60.0,
        fontWeight: FontWeight.w300,
        textBaseline: TextBaseline.alphabetic,
        letterSpacing: -0.5),
    displaySmall: const TextStyle(
        debugLabel: 'englishLike displaySmall 2018',
        inherit: false,
        fontSize: 48.0,
        fontWeight: FontWeight.w400,
        textBaseline: TextBaseline.alphabetic,
        letterSpacing: 0.0),
    headlineLarge: const TextStyle(
        debugLabel: 'englishLike headlineLarge 2018',
        inherit: false,
        fontSize: 40.0,
        fontWeight: FontWeight.w400,
        textBaseline: TextBaseline.alphabetic,
        letterSpacing: 0.25),
    headlineMedium: const TextStyle(
        debugLabel: 'englishLike headlineMedium 2018',
        inherit: false,
        fontSize: 34.0,
        fontWeight: FontWeight.w400,
        textBaseline: TextBaseline.alphabetic,
        letterSpacing: 0.25),
    titleLarge: const TextStyle(
        debugLabel: 'englishLike titleLarge 2018',
        inherit: false,
        fontSize: 20.0,
        fontWeight: FontWeight.w500,
        textBaseline: TextBaseline.alphabetic,
        letterSpacing: 0.15),
    titleMedium: const TextStyle(
        debugLabel: 'englishLike titleMedium 2018',
        inherit: false,
        fontSize: 16.0,
        fontWeight: FontWeight.w400,
        textBaseline: TextBaseline.alphabetic,
        letterSpacing: 0.15),
    titleSmall: const TextStyle(
        debugLabel: 'englishLike titleSmall 2018',
        inherit: false,
        fontSize: 14.0,
        fontWeight: FontWeight.w500,
        textBaseline: TextBaseline.alphabetic,
        letterSpacing: 0.1),
    bodyLarge: const TextStyle(
        debugLabel: 'englishLike bodyLarge 2018',
        inherit: false,
        fontSize: 16.0,
        fontWeight: FontWeight.w400,
        textBaseline: TextBaseline.alphabetic,
        letterSpacing: 0.5),
    labelLarge: const TextStyle(
        debugLabel: 'englishLike labelLarge 2018',
        inherit: false,
        fontSize: 14.0,
        fontWeight: FontWeight.w500,
        textBaseline: TextBaseline.alphabetic,
        letterSpacing: 1.25),
    labelMedium: const TextStyle(
        debugLabel: 'englishLike labelMedium 2018',
        inherit: false,
        fontSize: 11.0,
        fontWeight: FontWeight.w400,
        textBaseline: TextBaseline.alphabetic,
        letterSpacing: 1.5),
  );

  static InputDecorationTheme get inputDecorationTheme {
    return InputDecorationTheme(
      hintStyle: TextStyles.styleWith(16.sp, color: Colour.hintTextColor),
      counterStyle: TextStyles.f16,
      labelStyle: TextStyles.f16,
      contentPadding: EdgeInsets.zero,
      helperStyle: const TextStyle(color: Colors.red),
    );
  }

  static AppBarTheme get appBarTheme {
    return AppBarTheme(
        centerTitle: true,
        elevation: 0,
        backgroundColor: Colour.white,
        titleTextStyle: TextStyles.f17.boldStyle,
        iconTheme: IconThemeData(
          size: 20.w,
          color: Colour.mainTextColor,
        ),
        actionsIconTheme:
            IconThemeData(color: Colour.mainTextColor, size: 28.w));
  }

  //禁用输入框的放大镜功能
  static void disableTextMagnifier() {
    TextMagnifier.adaptiveMagnifierConfiguration = TextMagnifierConfiguration(
      shouldDisplayHandlesInMagnifier: false,
      magnifierBuilder: (
        BuildContext context,
        MagnifierController controller,
        ValueNotifier<MagnifierInfo> magnifierInfo,
      ) {
        switch (defaultTargetPlatform) {
          case TargetPlatform.iOS:
            return null;
          case TargetPlatform.android:
            return TextMagnifier(magnifierInfo: magnifierInfo);
          case TargetPlatform.fuchsia:
          case TargetPlatform.linux:
          case TargetPlatform.macOS:
          case TargetPlatform.windows:
            return null;
        }
      },
    );
  }
}
